package com.keep.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class ResponseResult<T> {
    public String code;
    public String msg;
    public T Data;

    public ResponseResult(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static ResponseResult ok(){
        return new ResponseResult(ResultEnum.SUCCESS_ENUM.getCode(), ResultEnum.SUCCESS_ENUM.getMsg());
    }

    public static ResponseResult fail(){
        return new ResponseResult(ResultEnum.FAIL_ENUM.getCode(),ResultEnum.FAIL_ENUM.getMsg());
    }

    public static ResponseResult response(ResultEnum resultEnum){
        return new ResponseResult(resultEnum.getCode(),resultEnum.getMsg());
    }
}
